'use strict';
const crypto = require('crypto')
module.exports = app => {
    const { STRING, INTEGER, DATE, ENUM } = app.Sequelize;
    // 配置（重要：一定要配置详细，一定要！！！）
    const Class = app.model.define('class', {
        id: {
            type: INTEGER(30).UNSIGNED,
            primaryKey: true,
            autoIncrement: true
        },
        title: {
            type: STRING(200),
            allowNull: false,
            defaultValue: '',
            comment: '标题名称',
        },
        image_url: {
            type: STRING(200),
            allowNull: false,
            defaultValue: '',
            comment: '图片路径',
        },
        parent_id: {
            type: INTEGER(30),
            allowNull: false,
            defaultValue: '0',
            comment: '父级Id',
        },
        sort: {
            type: INTEGER(30),
            allowNull: false,
            defaultValue: '1',
            comment: '排序 越小越前',
        },
        operation: {
            type: STRING(20),
            allowNull: false,
            defaultValue: '0',
            comment: '操作者',
        },
        status: {
            type: ENUM,
            values: ['0', '1',],
            allowNull: false,
            defaultValue: '1',
            comment: '状态 0禁用 1启用 '
        },
        created_at: DATE,
        updated_at: DATE,
    });
    return Class;
};